<?php
	/* **********************************************************/
	/* Arcans Project (2010)                                    */
	/* Jeu sous forme d'application web entièrement conçu       */
	/* et réalisé par Killian Le Maitre                         */
	/* Jeu sous licence GNU GPL v3 (voir NOTICE et COPYING)     */
	/* **********************************************************/

	//***********************
	//classe de gestion mysql
	//***********************
	class MysqlClass {
		//propriétés :
		private $db_infos;
		//méthodes :
		function __construct($level) {
			$bdd_xml = new DomDocument();
			$bdd_xml->load("xml/bdd.xml");
			$list_connect = $bdd_xml->getElementsByTagName("connect");
			foreach ($list_connect as $elt) {
				$att = $elt->getAttribute("level");
				if ($att == $level) {
					$this->db_infos["host"] = $elt->getElementsByTagName("server")->item(0)->textContent;
					$this->db_infos["user"] = $elt->getElementsByTagName("user")->item(0)->textContent;
					$this->db_infos["pwd"] = $elt->getElementsByTagName("pwd")->item(0)->textContent;
					$this->db_infos["db"] = $elt->getElementsByTagName("db")->item(0)->textContent;
					break;
				}
			}
		}
		public function resultFun($question) {
			$connection = mysql_connect($this->db_infos["host"], $this->db_infos["user"], $this->db_infos["pwd"]);
			mysql_select_db($this->db_infos["db"], $connection);
			return mysql_query($question);
			mysql_close($connection);
		}
	}
?>